]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
modemManager: Add property getters
authorPopax21 <matthias.pleschinger@gmail.com>
Thu, 15 Oct 2020 15:14:55 +0000 (15:14 +0000)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 3 Nov 2020 15:35:43 +0000 (16:35 +0100)
gjs improved its default property getter/setters, and as a result it
is no longer possible to set read-only properties.

Add proper getters (backed by private properties) to fix the resulting
errors.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3203

js/misc/modemManager.js

index 0de0b24e2f4a60763527b358be98a2825b113d61..5f727f3ca2164e061d890840e82cba3280a18f55 100644 (file)
@@ -111,17 +111,33 @@ var ModemBase = GObject.registerClass({
             0, 100, 0),
     },
 }, class ModemBase extends GObject.Object {
+    _init() {
+        super._init();
+        this._operatorName = null;
+        this._signalQuality = 0;
+    }
+
+    // eslint-disable-next-line camelcase
+    get operator_name() {
+        return this._operatorName;
+    }
+
+    // eslint-disable-next-line camelcase
+    get signal_quality() {
+        return this._signalQuality;
+    }
+
     _setOperatorName(operatorName) {
-        if (this.operator_name == operatorName)
+        if (this._operatorName == operatorName)
             return;
-        this.operator_name = operatorName;
+        this._operatorName = operatorName;
         this.notify('operator-name');
     }
 
     _setSignalQuality(signalQuality) {
-        if (this.signal_quality == signalQuality)
+        if (this._signalQuality == signalQuality)
             return;
-        this.signal_quality = signalQuality;
+        this._signalQuality = signalQuality;
         this.notify('signal-quality');
     }
 });